#! /usr/b/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 crane <crane@gosun>
#
# Distributed under terms of the MIT license.

"""

"""

def gray(n):
    b = list(int(i) for i in bin(n)[2:])
    for i in range(0, 4-len(b)):
        b.insert(0, 0)

    for i in range(len(b)-1, 0, -1):
        b[i] = int(b[i])^int(b[i-1])
    return b

def test():
    # n = 0
    # out = gray(n)
    # print(out)
    for i in range(16):
        print("%2s, %s" % (i, gray(i)))

def main():
    print("start main")
    test()

if __name__ == "__main__":
    main()
